﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using Telerik.Windows.Controls;
using System.Collections.ObjectModel;
using TotalSystems.Main.ViewModel;
using TotalSystems.Main.Infrastructure;
using GalaSoft.MvvmLight.Messaging;

namespace TotalSystems.Main.Views
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            DataContext = new MainPage_vm();

            Messenger.Default.Register<FormName>(this, "NavigatePage", p => NavigatePage(p));
        }

        private void NavigatePage(FormName formName)
        {
            RadTabItem tabItem = new RadTabItem();
            tabItem.Height = 28;
            tabItem.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            tabItem.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            tabItem.IsSelected = true;

            switch (formName)
            {
                case FormName.Base:
                    tabItem.Content = new Salary.Views.BaseInfo.Base();
                    mainTabControl.Items.Add(tabItem);
                    break;
                case FormName.Factor:
                    break;
                case FormName.DegreeImportantStuff:
                    tabItem.Content = new Store.Views.BaseInfo.DegreeImportantStuff();
                    mainTabControl.Items.Add(tabItem);
                    break;
                case FormName.RegimentationStuff:
                    tabItem.Content = new Store.Views.BaseInfo.RegimentationStuff();
                    mainTabControl.Items.Add(tabItem);
                    break;
                case FormName.Store:
                    tabItem.Content = new Store.Views.BaseInfo.Store();
                    mainTabControl.Items.Add(tabItem);
                    break;
                case FormName.TypeStore:
                    tabItem.Content = new Store.Views.BaseInfo.TypeStore();
                    mainTabControl.Items.Add(tabItem);
                    break;
                case FormName.UnitStuff:
                    tabItem.Content = new Store.Views.BaseInfo.UnitStuff();
                    mainTabControl.Items.Add(tabItem);
                    break;
                default:
                    break;
            }
        }
    }
}
